[SUBROUTINE]
version = 1.14
icon = polyline.png
name = _("Polyline")
type = polyline
help = _("<b>Create a closed or open Polyline</b>&#10;<span foreground='blue' style='oblique'><b>Message possible in terminal window</b></span>")
order = act fcut h2 x y h1 dx dy rot h6 comp dir items h7 cdir h5 orcs orcr orrev h3 atype height rev2

[PARAM_H1]
name = _("Offsets, rotation")
type = sub-header

[PARAM_H2]
name = _("Origin")
type = sub-header

[PARAM_H5]
name = _("Link")
type = sub-header
header = h7
tool_tip = _("Link style with previous item")

[PARAM_H6]
name = _("Cutting")
type = sub-header

[PARAM_H7]
name = _("Closing")
type = header
icon = close.png

[PARAM_ACT]
name = _("Active")
icon = enable.png
type = bool
value = 1

[PARAM_X]
name = _("X")
header = h2
type = float
icon = x.png
tool_tip = _("Origin X")
value = 0
metric_value = 0.0

[PARAM_Y]
name = _("Y")
header = h2
type = float
icon = y.png
tool_tip = _("Origin Y")
value = 0
metric_value = 0.0

[PARAM_DX]
name = _("dX")
header = h1
type = float
icon = dx.png
tool_tip = _("Offset origin")
value = 0
metric_value = 0.0

[PARAM_DY]
name = _("dY")
header = h1
type = float
icon = dy.png
tool_tip = _("Offset origin")
value = 0
metric_value = 0.0

[PARAM_ROT]
name = _("Rotation")
header = h1
type = float
value = 0.0
icon = angle.png
digits = 2
tool_tip = _("Rotation around offsets")
suffix = &#176;

[PARAM_ORCS]
name = _("Type")
header = h5
type = combo
options = _("None=0:Rounded=1:Beveled=2:Inverted Round=3")
icon = corner-style.png
tool_tip = _("Select link type")
value = 0

[PARAM_ORCR]
name = _("Radius")
header = h5
type = float
minimum_value = 0.0
icon = corner-radius.png
tool_tip = _("Radius for rounded or distance from apex")
value = 0.3
metric_value = 5

[PARAM_ORREV]
name = _("Complement")
icon = complement.png
type = bool
header = h5
tool_tip = _("Reverse direction of tool path for rounded or inverted round")
value = 0

[PARAM_COMP]
name = _("Kerf width compensation")
header = h6
type = combo
options = _("None=40:Left=41:Right=42")
icon = g4x.png
tool_tip = _("Which side torch will travel")
value = 40

[PARAM_DIR]
name = _("Direction")
header = H6
type = combo
options = _("Designed=0:Reverse=1")
icon = cw-ccw.png
tool_tip = _("Cut as designed or in reverse")
value = 0

[PARAM_ITEMS]
name = _("Items")
type = items
icon = items.png
tool_tip = _("Add polyline items here")

[PARAM_FCUT]
name = _("Show design")
icon = glasses.png
type = bool
value = 1

[PARAM_CDIR]
name = _("Closing item")
header = h7
type = combo
options = _("None=0:Straight line=1:Arc clockwise=2:Arc counter-clockwise=3")
icon = close.png
tool_tip = _("Closed or not and direction of closing line")
value = 0

[PARAM_H3]
name = _("Arc definition")
type = sub-header
tool_tip = _("Define arc")
header = h7

[PARAM_ATYPE]
name = _("Option")
header = h3
type = combo
options = _("Radius=0:Arc height=1")
value = 0
tool_tip = _("Select value defined")
icon = rad-arc-opt.png

[PARAM_HEIGHT]
name = _("Size")
type = float
header = h3
icon = line-len.png
value = 1
metric_value = 25
minimum_value = 0
not_allowed = 0

[PARAM_REV2]
name = _("Flip center")
type = bool
header = h3
icon = swap-side.png
value = 0
tool_tip = _("Center opposite side of chord")

[DEFINITIONS]
content =
;	<eval>self.include_once(file name here)</eval>

[BEFORE]
content =
	(begin #sub_name)
	(polyline author : Fernand Veilleux)
	o<#self_id_active> if [#param_act AND [#<in_polyline> EQ 0]]
		(init and set origin)
		o<poly_add_item> CALL [-1] [#param_x] [#param_y]
		
		#<in_polyline> = 1
		(begin #sub_name items)

[AFTER]
content =
		(end #sub_name items)
		#<in_polyline> = 0
		
		o<#self_id_end> if [#5000 GT 0]
		
			(return to origin w/ either a line 1 or an arc 5)
			o<#self_id_end0> if [#param_cdir GT 1]
				o<poly_add_item> CALL [5] [#param_x] [#param_y] [#param_cdir] [#param_orcs] [#param_orcr] [#param_orrev] [100] [#param_height] [#param_atype] [#param_rev2]
			o<#self_id_end0> else
				o<poly_add_item> CALL [1] [#param_x] [#param_y] [#param_cdir] [#param_orcs] [#param_orcr] [#param_orrev] [100]
			o<#self_id_end0> endif
		
			o<poly_create> CALL
			
			o<#self_id_rev> if [#param_dir]
				o<poly_reverse> CALL
			o<#self_id_rev> endif
			
			o<poly_copy_cut> CALL
	
			o<poly_cut> CALL [#<_mill_data_start>] [#<pl_cut_start>] [#<surface>] [#<bottom>] [#param_comp] [#param_fcut] [#param_dx] [#param_dy] [#param_rot]
			
		o<#self_id_end> endif
	o<#self_id_active> endif
	(end #sub_name)
